{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "f70f42e61b2f0fa8",
   "metadata": {},
   "source": [
    "Embedding嵌入可以让一组文本或者一段以向量来表示，从而可以让我们在向量空间中进行语义搜索之类的操作，从而大幅提升学习能力"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "8306458bad1f3ba7",
   "metadata": {},
   "source": [
    "## Embed_documents"
   ]
  },
  {
   "cell_type": "code",
   "id": "1876e54eeb959f",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2025-04-10T03:32:46.703517Z",
     "start_time": "2025-04-10T03:32:45.444293Z"
    }
   },
   "source": [
    "from langchain_ollama import OllamaEmbeddings\n",
    "\n",
    "embeddings = OllamaEmbeddings(\n",
    "    model=\"quentinz/bge-large-zh-v1.5:latest\",\n",
    "    base_url=\"http://10.2.4.31:11434\",\n",
    ")\n",
    "docs = embeddings.embed_documents([\n",
    "    \"你好\",\n",
    "    \"我的名字是阿海\"\n",
    "])\n",
    "print(docs)"
   ],
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[[0.0075496263, -0.022805985, -0.033484068, 0.046106864, 0.012772672, -0.020466307, -0.065553956, 0.034858476, 0.0102059655, -0.002866025, 0.024010722, -0.018200811, -0.009532552, 0.0013737942, -0.02421248, -0.014240676, 0.04697424, 0.011347221, 0.029365396, -0.05253818, 0.013749329, 0.0070227487, -0.07141681, -0.0036951785, -0.0064991624, 0.02199618, -0.0024022423, 0.02894055, 0.035979044, -0.05289832, 0.012253012, -0.029585369, -0.009813922, 0.01327186, 0.00227312, 0.029750792, -0.03008906, 0.010643186, 0.00048872083, -0.024968553, 0.015377979, -0.015435515, -0.0070469254, -0.014618197, -0.042266253, 0.008565421, -0.040230364, -0.005991079, 0.027846558, 0.04797589, -0.020720588, 0.025091743, -0.026621865, 0.033963688, 0.013426562, 0.05862592, 0.03750645, -0.025766801, 0.027195875, -0.08287642, 0.041265428, 0.06715557, 0.015477162, 0.007210685, 0.02802311, -0.014016356, 0.00879125, -0.041278385, -0.00934633, -0.032569975, -0.028440734, 0.014075398, 0.03625795, 0.010090019, 0.0013367339, 0.018884985, -0.012427793, -0.00072926504, 0.011218998, 0.036884844, -0.02678411, -0.01168712, -0.009962788, 0.020485269, 0.018478408, -0.01787549, 0.025936712, 0.34282637, 0.054124463, -0.013870652, -0.013526521, -0.0072485646, -0.015136468, -0.014155079, 0.029852327, 0.0029392038, 0.0058028996, 0.028200291, 0.019991945, 0.017662823, 0.0034660231, 0.01911378, -0.0060904566, -0.024668653, -0.00212577, -0.022181518, 0.005898251, 0.004309413, -0.015886405, -0.021481158, 0.036561403, 0.0031801264, 0.012682431, -0.021936804, -0.040244356, -0.0056324378, -0.0075504254, 0.01874399, 0.03396587, -0.013033113, -0.0083957855, 0.0029687933, -0.017564889, 0.016073171, 0.033959545, 0.03678648, 0.024391785, 0.016392503, -0.010189782, -0.0372609, 0.061324254, -0.021031337, 0.022410663, 0.035941307, 0.02108719, -0.0051237424, -0.03045419, -0.0078040427, 0.0022838218, -0.032910973, 0.020461274, 0.0052661207, -0.004561931, -0.0020894425, -0.002140002, -0.0037152087, -0.056090627, 0.023398254, -0.04181416, -0.009100837, 0.007093395, -0.028897054, -0.02197773, -0.013304651, -0.015638405, -0.016879244, -0.016461177, -0.004236668, -0.0068651796, 0.0074773617, -0.018204251, -0.0030249297, 0.037898395, 0.042063795, -0.019696739, 0.010795767, -0.04169543, 0.028052572, 0.042153522, -0.0020853244, -0.03630424, -0.07512078, -0.016431091, 0.03074205, -0.011648265, -0.057055313, 0.018392319, 0.035031706, 0.022318128, -0.00026706627, -0.016414206, -0.0007624228, -0.012227476, -0.023019874, -0.045396615, -0.014500024, 0.02685299, 0.02011736, 0.023959326, -0.03355159, -0.0070907334, 0.015460508, -0.028047878, 0.0093068825, 0.01303913, 0.036821816, -0.00872483, 0.0066160816, 0.054722015, -0.047187727, -0.003784512, 0.008583752, -0.008081931, -0.015201933, -0.014966595, -0.058297, 0.06742685, 0.019835304, 0.04089425, 0.0034329959, -0.050624825, -0.024489209, 0.0017679177, -0.01812864, 0.01304749, 0.02016338, 0.0034408192, 0.06375768, -0.029653557, -0.01911389, 0.018993882, -0.028719986, 0.024673771, -0.02996335, 0.013076851, 0.0073540565, 0.028811524, -0.017680455, -0.035933137, 0.03599187, -0.024371648, -0.011692326, 0.04866541, 0.026711471, 0.004526622, 0.036575835, 0.02104556, -0.009403032, -0.057486556, -0.031548098, -0.049201734, 0.032993622, 0.0067281337, -0.009237528, 0.037608214, 0.018078048, 0.044050176, 0.013480397, 0.013796865, 0.023753218, 0.036756545, 0.025809282, -0.038162407, -0.031134691, -0.03278042, 0.002378342, 0.041140124, 0.025387708, -0.020243213, -0.024929868, -0.0110083725, -0.022407154, -0.034646567, -0.00609024, 0.029233359, 0.044097017, 0.006760192, 0.00079947483, 0.031512693, 0.033234503, 0.04299834, 0.0010659691, -0.010746375, -0.021904118, 0.00184276, -0.014732839, -0.04655895, 0.011445878, 0.0049703517, -0.004796229, 0.004945683, -0.0021747972, 0.011543588, -0.021039756, 0.04489744, 0.014167228, -0.037354603, 0.019855581, 0.0069254516, -0.018237269, -0.039505433, 0.018629435, -0.025189888, -0.0075816815, 0.032117628, 0.060634356, 0.014304311, -0.0032981695, 0.0035163981, -0.0109145595, 0.020578267, 0.023927009, 0.072883874, 0.017769352, 0.049291633, -0.032280993, 0.0046834266, -0.025145441, -0.008043811, 0.009350422, -0.030536061, -0.10299586, 0.0039569214, -0.063256, 0.073419474, 0.00055412686, -0.008998466, -0.0057880078, 0.0149324825, 0.08002419, -0.0032464531, 0.009828324, -0.039406504, -0.04726058, 0.010313516, 0.031512685, 0.015200832, -0.015673317, -0.024363067, 0.022898583, 0.023971608, 0.02582446, 0.009723929, -0.04711475, 0.02410932, 0.046880934, 0.031879436, -0.004934318, -0.044517882, 0.03469711, 0.033888575, -0.07749758, -0.0048456118, -0.04730571, -0.021605743, 0.023871286, -0.014745741, -0.0397588, -0.023193784, 0.005373949, 0.027431972, -0.01705423, 0.0049894187, -0.03472496, 0.014502198, -0.0020073096, 0.033705782, -0.014350954, 0.029981988, 0.08561132, -0.030093376, 0.013615833, 0.030038835, -0.05442462, 0.012954293, -0.014454787, -0.052446198, 0.0047016623, -0.054735027, 0.0037453726, 0.03623288, 0.050055206, -0.019559873, -0.005738312, -0.008609803, 0.02288085, 0.0038545905, -0.029325914, 0.008944057, 0.025008224, 0.01270315, 0.024292491, -0.03432735, 0.0032666095, 0.006470009, -0.010517337, 0.018986031, -0.014930489, -0.06182868, -0.013615215, -0.020271936, 0.005655972, -0.0638729, -0.02908367, -0.043683298, 0.02625865, -0.023785349, -0.011436055, -0.036485232, -0.0126054045, -0.0037784164, 0.008695309, -0.013872411, -0.014145225, 0.021947859, -0.017869065, 0.008473636, 0.034741566, 0.006770145, -0.031017473, -0.010766609, -0.011582972, -0.008851855, 0.0019302124, 0.008468093, 0.07223714, 0.016583934, -0.04747186, -0.020706581, -0.01387519, 0.015695896, 0.027570928, 0.017384866, 0.017359983, 0.012664404, -0.03199083, -0.038300186, -0.031248849, -0.017744772, -0.052057315, 0.004759559, 0.030874133, -0.010446785, -0.006476775, 0.04080177, -0.0091475425, -0.013814309, 0.009368795, -0.025256848, 0.06882955, -0.025237314, -0.0039947787, 0.015448433, -0.007545032, -0.015517246, 0.03842832, 0.0024661885, -0.093868986, -0.0026920328, 0.006906307, -0.002497138, 0.051572718, -0.015160741, -0.011921982, 0.021157365, 0.009736347, 0.008865862, -0.020944728, -0.03273352, 0.040551234, 0.046397228, -0.0077567147, 0.0013642068, -0.015289295, -0.0035490866, -0.007653983, -0.059803534, -0.018200425, 0.03849636, 0.011466459, -0.015904283, -0.022904515, -0.009992429, 0.0003056479, -0.030661482, 0.016656464, -0.030885724, 0.00058576633, -0.035563715, -0.015606816, -0.004999172, 0.01978236, -0.023906799, -0.022489218, 0.028127806, 0.019090459, -0.00063214626, 0.032315888, 0.03078232, -0.024373548, 0.013936373, -0.030053511, -0.04199081, 0.000797107, 0.043752886, -0.00934269, -0.022947326, -0.026744561, -0.06186553, -0.008146575, 0.008598856, 0.043874726, 0.0581427, 0.014868984, 0.0033802993, -0.054735795, -0.056052193, 0.016207388, -0.0038043808, 0.0116942525, 0.018075926, -0.028836785, -0.013207741, 0.022065967, -0.0063880854, -0.012103956, 0.046830878, -0.027212003, 0.032823086, -0.0009595974, 0.0007323895, 0.0025286411, 0.03500553, -0.023192525, -0.031932313, 0.0015880984, -0.017557522, 0.02488409, -0.034745213, -0.039465398, -0.044880655, -0.029833846, 0.008224411, 0.030259637, -0.0013928416, 0.0035540068, -0.010736019, 0.02321525, -0.02310834, -0.017977986, 0.0063797734, 0.000100725185, -0.011607027, 0.0067216917, 0.029800067, 0.050905835, -0.015840245, 0.0017380761, 0.058562893, 0.017257348, -0.012052609, 0.007905158, 0.0050918655, -0.038634438, -0.0021493535, 0.057090797, 0.0048364745, 0.02682746, -0.013656773, 0.006539456, -0.02592239, 0.020434173, 0.02894102, -0.06017825, 0.032765884, 0.007863703, 0.016477022, 0.032899536, 0.0023841073, 0.02355988, -0.02577256, 0.02216504, -0.040790386, -0.007651236, 0.0118463, 0.010842084, -0.0030747782, -0.025821205, -0.09945185, 0.0556133, 0.04353491, -0.026329696, 0.025146378, -0.039068837, -0.018326446, -0.0048667346, 0.032823607, 0.024789296, -0.031633526, -0.045095295, -0.024836907, -0.00042918496, 0.007274636, -0.018763905, 0.020710506, 0.001047708, -0.0059901117, -0.0027748523, -0.005271413, -0.038109615, -0.021012843, 0.03380563, -0.066933855, -0.025671283, -0.02850886, -0.015987601, -0.013077729, 0.03174804, -0.01371418, -0.007769446, 0.009447947, 0.0024106354, 0.009131533, 0.02034048, -0.0072199116, -0.0366312, 0.022575961, -0.0007930246, 0.0071051675, 0.014243968, 0.024754655, 0.00082829694, 0.014410991, -0.020170076, -0.0062948186, -0.031495143, -0.013952516, 0.057224736, -0.06939839, -0.0068074246, -0.012044366, 0.009787529, 0.0430168, 0.023511546, -0.027337922, 0.015827663, -0.06072063, 0.015888348, -0.04066123, -0.050917014, 0.006202242, -0.00633905, 0.0023708781, -0.018726725, 0.01836676, -0.026083972, -0.017925646, 0.0024259996, -0.01854121, -0.004395897, -0.021289477, 0.009154413, -0.020065932, 0.025587605, -0.024887847, 0.01878431, -0.041588493, 0.009691066, 0.029259676, -0.010400749, 0.03085528, 0.05120732, 0.0357253, 0.06108705, -0.048551925, -0.023904324, 0.011756083, -0.00033197305, -0.008332918, 0.003104961, 0.028081259, 0.028827371, 0.007985191, 0.039632525, 0.044199705, 0.028161313, -0.0005077923, 0.00579803, -0.032819305, 0.025592173, -0.048580736, -0.054913238, 0.008835145, 0.0246119, 0.07494525, -0.041307945, -0.031209342, 0.006372961, 0.0694333, -0.02161747, 0.0045118798, 0.032436818, -0.00732845, -0.007688734, 0.00953799, 0.009431123, 0.024449617, -0.028612943, -0.009107872, -0.020452188, -0.07117963, 0.015571339, -0.023453329, -0.026737086, 0.0079497015, 0.06502512, 0.05569855, 0.035063334, 0.009540002, 0.017993098, -0.023524204, -0.050383598, -0.01448791, 0.029218491, -0.03519365, 0.056924116, 0.0079661105, 0.026738541, -0.008098538, 0.031641465, 0.015001954, -0.0051366533, -0.04515504, 0.014249751, 0.016390063, -0.082013875, 0.017326541, -0.030957544, 0.039994355, -0.039730452, 0.01823787, -0.05893927, -0.03969189, -0.020993313, 0.0026600517, -0.03366239, -0.0050047887, -0.029749598, 0.0046776324, -0.012714106, -0.03749604, 0.025036268, -0.011511375, 0.046557084, -0.0057875374, -0.015044359, -0.00813327, -0.025898188, -0.05279972, 0.022075796, 0.022207674, -0.009031696, -0.015588799, -0.03896243, 0.011214363, -0.009115797, -0.0012120228, -0.012586427, 0.033941265, -0.0013309846, -0.0039762114, 0.0033875918, 0.008956779, -0.07069972, -0.00205157, -0.010597645, -0.008109843, -0.0011705299, -0.03752771, 0.05419427, 0.0028773316, 0.033165723, -0.031611443, 0.03680646, -0.033968586, -0.025215965, 0.07039179, 0.0037297157, 0.020083306, 0.014545429, -0.0035915799, -0.024665957, 0.0011824535, -0.04581935, -0.049107492, 0.0024864096, -0.011642143, 0.027620062, 0.003933853, -0.04036998, -0.04333539, -0.014635805, 0.023639288, -0.058789536, -0.01985806, 0.025479458, -0.041592065, 0.045920946, 0.010777717, -0.00921111, 0.003914655, 0.024534997, -0.08657462, -0.017194817, -0.017380442, 0.007120891, -0.018877763, 0.0020380542, -0.073010616, -0.011492414, -0.047643635, -0.018970337, 0.025267186, -0.0059585935, 0.011406887, 0.021489322, 0.031570233, -0.0026898389, 0.017346948, 0.009136933, 0.0033829624, 0.010357425, -0.009417958, -0.03957194, 0.018851586, 0.041266605, 0.014128871, -0.034071054, -0.043445293, 0.0027508335, -0.028417313, 0.017238498, -0.05430436, -0.01458727, -0.054042052, -0.008059604, -0.028488582, -0.021757137, 0.042163078, -0.018457307, -0.03749477, 0.009851431, 0.029136587, -0.103063144, 0.01982896, 0.0027895782, 0.04288362, 0.04056029, 0.059460357, 0.02513238, -0.007492589, -0.058880694, 0.003297151, -0.043117482, -0.026689902, -0.0294588, 0.06793094, 0.02544523, 0.010156794, -0.039471153, -0.01355345, 0.0008663873, 0.040679693, -0.041574653, 0.016525844, -0.055896085, -0.010899757, -0.028676076, -0.024482004, 0.0047384123, 0.019737307, -0.01039833, 0.009577597, 0.028303215, 0.01788509, 0.014729233, -0.04946988, -0.0067898035, 0.0006362448, 0.015638787, 0.03965227, 0.028313491, 0.00041784722, 0.031876713, 0.008754666, -0.022156093, -0.015577686, 0.0033453282, 0.03516911, 0.016229171, 0.034814317, -0.035088312, -0.04012515, 0.011074883, -0.021811537, -0.010953135, 0.03402542, -0.0076650465, 0.014347608, -0.010315219, -0.053649902, 0.011662655, 0.019596204, -0.0008014874, -0.033074725, 0.061668564, -0.0064450563, -0.06841488, -0.01751396, -0.0012243709, 0.055332117, 0.018837199, 0.041143842, -0.020662822, -0.02441589, -0.020985646, -0.0095419455, -0.014023322, 0.02394465, -0.023395885, -0.040962994, 0.03945814, 0.016754046, 0.05421814, 0.027606191, -0.004461327, 0.018071858, 0.012011245, -0.032298323, 0.0026583448, -0.038313415, 0.023887994, 0.0106552765, -0.008163201, 0.03548989, 0.031021774, -0.009633869, -0.01872017, 0.0054814764, 0.025741523, 0.049986485, 0.01598017, -0.0069089923, -0.04136324, 0.052560084, -0.028019467, -0.018833574, -0.010141304, 0.04603037, -0.012085376, -0.0002049615, -0.038082987, 0.0026901192, -0.010936974, 0.029849272, 0.025635319, -0.029326392, -0.066676274, -0.0088179875, 0.007880651, 0.015418204, 0.010812627, 0.016188636, 0.029330626, -0.03354729, -0.05886907, 0.002924815, -0.018181002, -0.019755317, 0.00021854311, 0.008171815, 0.041539125, 0.03949633, -0.009263455, -0.030007644, 0.044641536, 0.0013155413, 0.0012509704, -0.0034751375, 0.027807092, -0.033965714, -0.037753634, 0.0015598092, 0.033313412, 0.022046313, 0.00085139787, 0.06728205, -0.03927742, 0.009827049, 0.024575619, 0.0081649525, 0.031156661, -0.014461709, 0.019782858, 0.00075581344, -0.040400878, -0.0017204698, 0.0148182, 0.04085084, 0.022588985, -0.025084184, 0.03980436, 0.003811333, -0.03193648, -0.019062653, 0.007349999, 0.0012357566, -0.0124309, -0.04314083, -0.031775553, -0.007632971, 0.021921951, -0.00043641878, -0.0063525783, 0.009188715, 0.039113965, -0.067692965, -0.0017836974, -0.02032625, -0.031428427, -0.0020941424, -0.0301965, -0.051061377, 0.007861571], [-0.032499354, -0.017042654, 0.017801251, -0.013797833, 0.044246823, 0.028461073, 0.0010259481, -0.026850214, 0.025292417, -0.041700367, -0.008692553, 0.043172244, -0.028056797, 0.032516476, -0.030813895, -0.0450126, 0.008456454, 0.034682542, 0.036236193, -0.06359148, -0.018497294, 0.011472891, 0.007852477, -0.01037943, 0.004908885, -0.04358679, -0.03787358, 0.02328879, 0.022505328, -0.008978508, -0.041562118, -0.03283105, -0.032719307, 0.021966327, 0.011131356, 0.04190554, -0.06252733, -0.014707481, 0.019505318, 0.0037890212, -0.0077619925, 0.016984954, -0.06299303, 0.037179083, 0.010025128, -0.014409152, -0.017621908, 0.018536283, 0.016250173, 0.021436572, -0.04097582, -0.019084143, -0.0033429738, 0.024005054, -0.0021773037, 0.013200206, 0.008930979, 0.011573019, 0.0031609787, 0.0018067071, -0.0016650736, 0.069646426, 0.03965475, -0.009854803, -0.011504319, 0.06262134, -0.010250366, 0.0130317975, 0.038950335, -0.0017358873, 0.041379992, -0.0014062324, 0.011480572, 0.00038828797, -0.0021056302, 0.022418674, 0.021426994, -0.026192514, -0.0022101644, 0.011957791, 0.011644159, -0.021043466, -0.030026063, 0.009826346, 0.027629972, -0.02300908, 0.026491022, 0.3311203, 0.009928967, -0.07372145, -0.00064564624, 0.0069943396, -0.047874447, 0.007050404, 0.030254276, 0.002420468, -0.012636349, -0.006448458, -0.018468939, 0.024652945, 0.062977, 0.022711521, 0.012211021, -0.031405337, 0.003742952, 0.034931492, 0.0033322861, -0.04264179, 0.049244743, 0.02464977, 0.017639266, -0.07030529, -0.01361567, 0.015454996, 0.017349878, -0.01761931, 0.008367807, -0.060866147, 0.0016831466, -0.06539501, -0.008179092, 0.016499545, 0.022276454, -0.011255755, 0.009761844, 0.013655712, 0.08727617, 0.032868866, 4.7265505e-05, -0.013485721, 0.0030544624, -0.03799131, 0.0141820265, 0.030148104, -0.005610203, -0.03559219, -0.023487756, -0.0048931087, -0.029230013, -0.019062074, -0.0103522595, -0.015947549, -0.050198622, 0.0013564175, 0.01696057, -0.016469408, -0.08253277, 0.011615841, -0.0403756, 0.016826212, -0.033957075, -0.01157818, 0.039089464, 0.012712856, -0.0405235, 0.012084876, 0.020424644, 0.017114934, 0.020657102, 0.010687965, -0.036041446, 0.024120323, 0.04608607, 0.06547144, 0.023972303, 0.051082656, -0.0030741699, 0.01741704, -0.017679857, 0.015303461, 0.00041997104, -0.01060596, 0.0018777509, -0.0144715365, -0.042666152, -0.037673388, -0.009101585, -0.0061852965, -0.021667007, 0.009715086, 0.023483211, 0.03122297, 0.040392254, -0.011018668, -0.03128676, 0.012757066, -0.0137370005, 0.012502026, 0.029099507, -0.010598493, -0.0028116086, 0.021315884, 0.0046482165, -0.034941833, -0.029016145, 0.03064555, 0.017533405, -0.008221877, 0.062283255, 0.04438417, 0.08475667, 0.012305756, -0.03527078, -0.042320225, 0.02571551, -0.022992285, 0.02640656, 0.02356849, 0.038426895, 0.013106874, -0.05532392, -0.010831579, 0.02441081, 0.016008567, 0.033361014, -0.036820084, -0.040390003, -0.004099774, -0.053692073, -0.05447555, 0.029912705, -0.0027871924, -0.017559275, -0.01631988, 0.02505381, 0.0018860816, 0.006145447, 0.022549283, -0.013036427, 0.05792358, -0.009037137, 0.025791194, 0.0123814875, 0.0052750264, -0.011939544, -0.015995122, 0.006992308, -0.001725387, -0.020178003, 0.020104332, 0.021833519, -0.004619245, 0.009656709, -0.018590456, -0.016054943, -0.0058138077, -0.006555266, 0.0071238736, 0.017954534, 0.005210416, -0.019091006, -0.018743455, -0.07955928, 0.020244222, -0.03012423, -0.053279683, 0.020394962, -0.05031398, 0.038335845, -0.012415592, -0.018412892, -0.056388892, -0.015357259, -0.024131173, -0.0065072295, 0.02814761, -0.0069631073, 0.018524986, 0.022372857, -0.00045135967, -0.014894806, 0.023548687, -0.027241163, -0.0343224, 0.0028433122, -0.012855919, -0.020761676, -0.005553424, 0.005578468, 0.01206004, 0.00590621, -0.037479956, -0.040783014, 0.02253861, 0.015056442, 0.015116636, 0.0010287737, 0.010036057, -0.011448847, -0.03270038, 0.01804051, -0.025017653, -0.043318696, 0.053261504, 0.0011568468, 0.029150387, -0.034987334, -0.024541011, -0.10019732, 0.0008108822, -0.009069812, -0.020267986, 0.026267052, 0.0035782387, -0.061002493, 0.051024728, 0.030222882, -0.02111725, -0.009969555, 0.00657798, 0.018727383, -0.009105105, 0.016037246, -0.0120049, 0.019114604, 0.011598176, 0.020955168, 0.010974992, -0.023852944, 0.015714794, -0.020101262, -0.005920897, 0.010801357, 0.034563385, 0.00032978455, -0.023965431, -0.035516698, 0.03226079, 0.0063256007, 0.010721218, -0.009107732, 0.012455472, 0.02181395, -0.01245409, -0.006329202, -0.008993676, -0.02207359, -0.03591949, -0.02787679, 0.031121915, 0.010174355, 0.0019835792, 0.009256587, 0.0060479767, 0.026518129, -0.009783801, -0.003113312, -0.017041178, 0.034027338, -0.017767094, 0.0013659728, -0.0061988407, 0.018045703, -0.036629587, 0.05571905, 0.029931784, -0.039537597, -0.0024042772, 0.014577813, 0.031436283, -0.05933961, 0.017477497, -0.032037243, -0.027488152, 0.002006521, -0.012934293, -0.024671048, -0.013201011, -0.047507413, -0.012691928, 0.011622542, 0.05570531, 0.002782661, 0.0028911687, 0.010687665, -0.0049916515, -0.013374121, -0.023190407, 0.019212825, 0.014124584, 0.0015945999, 0.03475401, 0.008502776, -0.007698013, 0.03225464, 0.021428678, 0.0001233602, 0.010500727, 0.015297727, -0.010407368, -0.0140927415, -0.029271036, -0.045947444, -0.020562682, -0.0034534805, -0.025588077, 0.005764309, -0.0040396177, 0.0023348895, 0.024159068, 0.039271545, -0.0020414798, -0.019675761, -0.030109134, 0.021448657, 0.030523129, 0.025128089, 0.002431807, 0.022307698, -0.033854734, -0.020532895, -0.03918801, -0.06689026, 0.003500352, -0.044047177, 0.024828527, 0.0024916546, -0.018744081, -0.036925122, 0.02657863, 0.009319636, 0.02112874, 0.003509484, -0.023579804, -0.03615375, 0.006568939, -0.0045497357, -0.054578643, -0.004385331, 0.03946021, -0.03622226, 0.03024974, -0.056458235, 0.005926594, 0.049110938, 0.036302682, 0.022944653, 0.05796678, 0.01864363, 0.04384836, 0.0022678939, -0.009688603, 0.05436147, -0.015037616, -0.0136356335, 0.011542578, 0.005368147, -0.03540605, -0.0011427859, 0.021435756, -0.0024140019, 0.0079830345, 0.017203463, -0.014263323, 0.02873494, -0.02314769, 0.009259343, -0.0332197, 0.014559856, -0.019499423, 0.028392743, -0.023935843, -0.041429777, -0.027829496, 0.004185623, 0.054078866, -0.00965837, 0.045095604, 0.01346319, -0.06183048, -0.038864527, 0.06094258, -0.034213703, 0.0039296923, 0.0028948917, 0.008889446, -0.040475283, -0.0038043864, -0.00765116, -0.0061768023, -0.01567572, -0.007687001, -0.055153634, -0.007936912, 0.054058652, 0.033496477, -0.055860247, -0.004264348, -0.00981936, -0.042552274, -0.009870297, 0.0024939312, 0.0042485665, -0.010553187, 0.016574806, -0.02499103, -0.022133889, -0.010043674, -0.0330247, -0.0021348093, 0.011399385, -0.017876841, 0.005282167, -0.00045101796, 0.029586537, -0.06977736, -0.019045386, 0.031177223, -0.044621147, 0.051854655, 0.018039118, -0.02145872, 0.016384473, -0.011461231, -0.003314913, 0.040607568, -0.027089147, -0.045514144, 0.026284484, 0.011204307, -0.055830125, -0.021050144, -0.011985229, -0.002768842, 0.012016255, -0.090878226, -0.020862082, 0.01851503, -0.0034892815, 0.008820632, -0.054082397, -0.009821913, 0.020833367, -0.0063524125, -0.016282108, -0.007325597, 0.0021115637, -0.019219672, 0.043364983, -0.052043315, -0.0040947045, 0.014749679, 0.020800788, -0.0042301877, -0.044326104, -0.0015295453, -0.004482972, 0.0024002835, -0.0164333, -0.03378488, -0.0076932097, 0.05519795, 0.0038442332, -0.02250605, -0.008204862, 0.02257998, -0.008915019, -0.015252362, 0.029129902, -0.012310661, -0.0447753, 0.056789942, 0.0045546484, -0.0021317182, -0.014938913, 0.016934602, 0.04154079, 0.012103872, 0.010557693, 0.012579979, -0.013513123, -0.024388341, -0.058455016, -0.0048933285, -0.002375916, -0.014219892, -0.06182079, 0.026419982, 0.0046457523, 0.007598208, -0.007396615, -0.027063431, 0.018301176, -0.0019910687, -0.0076416736, -0.004083842, -0.0047446773, -0.0051525543, -0.055559784, 0.0050339177, -0.041145228, -0.012649165, -0.027599713, 0.013075613, -0.022162331, 0.007624579, -0.013617504, -0.017890383, 0.013813173, -0.03230653, 0.041678987, 0.00021971924, -0.03150126, 0.020201966, -0.07144752, -0.016627481, -0.0008494236, 0.06502424, -0.003795179, -0.01741694, 0.0066744406, 0.0024026127, -0.001505933, 0.06405347, -0.00896476, -0.003973772, 0.009797437, 0.016430631, -0.014307716, -0.009583706, -0.010777483, 0.004762552, -0.03714765, -0.028958315, -0.0513303, -0.0434694, -0.01060113, 0.06548623, 0.029180782, -0.023963476, 0.014882443, 0.0005322968, -0.080489315, 0.039831135, 0.028895402, -0.00230441, -0.02937324, 0.05777424, -0.0005346833, 0.0020516384, 0.023774676, 0.025282271, 0.042451065, -0.015461863, 0.0045144814, -0.026317356, -0.00039901445, 0.0035275947, -0.029702544, 0.0063181357, -0.045692008, 0.012286676, -0.016957724, -0.02927427, 0.02747864, -0.014326187, 0.023598844, -0.003898542, 0.02612292, 0.008126651, -0.01551498, -0.029783081, 0.048621096, -0.022040918, 0.0014113735, -0.01588355, 0.0491664, 0.02138174, 0.024786426, -0.045430787, 0.015860982, 0.0037447228, -0.002961645, 0.0684727, 0.016859932, 0.0198001, -0.0060608657, -0.01280323, -0.007071434, -0.009321309, 0.03396788, -0.005236378, 0.08762407, -0.05139297, 0.08789503, -0.04653163, -0.08852931, -0.06941352, 0.07435397, 0.028694846, 0.03399611, -0.018120503, 0.018782135, -0.007078511, 0.010249869, 0.021867627, -0.033470914, 0.033947002, 0.026049206, 0.038217895, -0.037167802, 0.011586649, -0.014709589, 0.035450377, 0.003061598, 0.035327666, 0.03888193, 0.024163317, -0.01387209, -0.00836807, -0.05126057, -0.022169936, 0.008686813, 0.0419788, 0.06474724, 0.03362858, 0.010371193, -0.031893596, 0.00072235486, 0.06363397, 0.052148502, 0.0046367813, -0.011698937, -0.01668103, -0.011040849, -0.041807078, 0.021548346, -0.03654309, -0.009433299, -0.024275066, -0.011454956, -0.008811408, -0.028679054, -0.051670346, 0.023060422, 0.016222617, -0.019975763, -0.015773218, 0.018683534, -0.018383732, 0.018363014, 0.025708482, -0.021144468, 0.030607441, 0.023814226, -0.024321968, 0.004384181, 0.02230903, -0.010655201, 0.0034379393, -0.040697914, -0.011020479, -0.05093181, -0.065073445, -0.034088667, 0.0147272535, 0.042877432, 0.025157053, -0.008954126, -0.011070352, -0.014565495, 0.008686046, 0.05220743, 0.01370692, 0.004596799, -0.06543645, 0.0039627054, 0.022924418, 0.002763912, 0.05944088, 0.0037284414, 0.03916292, 0.008192906, 0.047670994, -0.058917157, 0.0252409, 0.030903049, -0.039098267, 0.05854308, 0.05064396, 0.038428217, -0.03270715, -0.0374006, -0.04875967, -0.06641651, -0.080534205, 0.044569682, -0.037373263, 0.030256879, -0.035266705, -0.030592471, 0.03839063, -0.022168571, -0.028248858, -0.07051887, 0.005313847, -0.042917766, -0.014334912, -0.009558091, -0.030903209, -0.047077328, 0.00881347, -0.0346205, -0.005751549, -0.0018657766, -0.0456358, -0.0147031145, 0.0026126644, -0.05970617, -0.015076763, -0.019463584, -0.020389725, 0.003921504, 0.0032601298, 0.013062198, -0.010952248, 0.043603737, -0.041877612, -0.013189761, -0.002803802, 0.02228348, 0.02721822, -0.0021433546, -0.016506072, 0.032603756, 0.021065483, 0.03268986, -0.036343258, -0.081124775, -0.031528436, 0.03537296, 0.042091608, -0.03342354, 0.053930975, -0.04080933, -0.04334374, 0.058996905, -0.01127587, 0.031641997, -0.00054810505, 0.0033140073, -0.036462173, 0.041471593, -0.01873087, 0.0013651018, 0.028742757, 0.065677464, -0.02180796, 0.038817935, 0.05085398, -0.005114086, -0.018900547, 0.011815524, 0.02558734, -0.011737533, -0.027553935, -0.04832322, 0.0010845544, 0.04398786, 0.041018143, -0.03372472, 0.036258537, 0.046100117, -0.04682431, -0.0048568696, 0.00077858986, 0.011706742, 0.0071356534, 0.014131476, -0.005013743, 0.04309637, 0.022356816, 0.012554179, -0.010606173, 0.017319158, -0.004080867, -0.052048057, 0.014174607, -0.02881607, 0.0015128651, -0.020364845, -0.014734473, -0.011082844, -0.007286304, 0.009789661, 0.03834687, 0.01963774, -0.002783343, 0.03379242, -0.0047020623, 0.014255736, -0.06303433, -0.020677457, -0.035037912, -0.0035803525, 0.009778893, -0.0045097624, -0.015071621, -0.008683997, -0.028488554, -0.031096492, -0.02833097, 0.044312276, -0.0037308591, 0.04412596, -0.012483399, 0.03831616, -0.009057972, -0.05580857, 0.008445738, 0.032008067, 0.0037782106, 0.037114438, 0.0029118457, 0.006181326, -0.010819554, -0.038577333, 0.032778352, 0.009754729, 0.01984255, -0.04643255, 0.010731319, 0.0388583, -0.009741395, 0.00041982872, -0.022559073, 0.03399969, -0.0023398797, -0.06513814, 0.009330832, 0.0023802563, 0.003754152, -0.025871921, 0.019772252, 0.008403692, -0.020364812, -0.039574143, -0.02318463, -0.02373442, -0.021741955, 0.015913533, -0.015358407, -0.017948957, -0.014681707, 0.019049712, 0.030143222, 0.026446627, -0.015510489, -0.027416825, -0.05509527, 0.021105956, -0.03660731, -0.033290654, 0.034124978, 0.0020931484, -0.0010405346, 0.04135958, -0.06815302, 0.021069743, 0.040404715, -0.04481281, 0.0141670555, -2.9289582e-05, 0.04301266, -0.026519185, 0.0058857743, 0.01878396, 0.001506094, 0.02093519, -0.0073111905, 0.004525566, 0.018196825, -0.0067902887, -0.03258885, -0.04700622, 0.020455947, -0.016913073, -0.004684697, 0.010090337, -0.004541025, 0.053383373, 0.00423512, -0.012759372, 0.06180194, -0.020712331, -0.0056584543, 0.0059602177, -0.027985703, -0.0482393, 0.0077115567, 0.015706534, 0.011531855, 0.001191369, 0.03404764, 0.053621992, -0.03490831, 0.028641794, -0.003953784, 0.02536234, -0.006408592, -0.024309844, 0.05766523, -0.028466681, -0.025298033, 0.007759033, -0.017426224, 0.046307974, 0.014486498, -0.030571474, -0.025323642, -0.006252003, 0.040866368, 0.028290348, 0.006088759, 0.020629425, 0.012581889, -0.014071818, -0.007367687, 0.002589562, 0.01686063, 0.017252523, 0.008348934, -0.062194616, 0.010576274]]\n"
     ]
    }
   ],
   "execution_count": 1
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "id": "f01191e8f23a397a",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2025-04-10T01:26:01.816905Z",
     "start_time": "2025-04-10T01:26:01.655551Z"
    }
   },
   "outputs": [
    {
     "ename": "RuntimeError",
     "evalue": "Failed to import transformers.models.bert.modeling_bert because of the following error (look up to see its traceback):\nFailed to import transformers.generation.utils because of the following error (look up to see its traceback):\nAll ufuncs must have type `numpy.ufunc`. Received (<ufunc 'sph_legendre_p'>, <ufunc 'sph_legendre_p'>, <ufunc 'sph_legendre_p'>)",
     "output_type": "error",
     "traceback": [
      "\u001B[0;31m---------------------------------------------------------------------------\u001B[0m",
      "\u001B[0;31mValueError\u001B[0m                                Traceback (most recent call last)",
      "File \u001B[0;32m/opt/anaconda3/envs/langchain/lib/python3.10/site-packages/transformers/utils/import_utils.py:1967\u001B[0m, in \u001B[0;36m_LazyModule._get_module\u001B[0;34m(self, module_name)\u001B[0m\n\u001B[1;32m   1966\u001B[0m \u001B[38;5;28;01mtry\u001B[39;00m:\n\u001B[0;32m-> 1967\u001B[0m     \u001B[38;5;28;01mreturn\u001B[39;00m \u001B[43mimportlib\u001B[49m\u001B[38;5;241;43m.\u001B[39;49m\u001B[43mimport_module\u001B[49m\u001B[43m(\u001B[49m\u001B[38;5;124;43m\"\u001B[39;49m\u001B[38;5;124;43m.\u001B[39;49m\u001B[38;5;124;43m\"\u001B[39;49m\u001B[43m \u001B[49m\u001B[38;5;241;43m+\u001B[39;49m\u001B[43m \u001B[49m\u001B[43mmodule_name\u001B[49m\u001B[43m,\u001B[49m\u001B[43m \u001B[49m\u001B[38;5;28;43mself\u001B[39;49m\u001B[38;5;241;43m.\u001B[39;49m\u001B[38;5;18;43m__name__\u001B[39;49m\u001B[43m)\u001B[49m\n\u001B[1;32m   1968\u001B[0m \u001B[38;5;28;01mexcept\u001B[39;00m \u001B[38;5;167;01mException\u001B[39;00m \u001B[38;5;28;01mas\u001B[39;00m e:\n",
      "File \u001B[0;32m/opt/anaconda3/envs/langchain/lib/python3.10/importlib/__init__.py:126\u001B[0m, in \u001B[0;36mimport_module\u001B[0;34m(name, package)\u001B[0m\n\u001B[1;32m    125\u001B[0m         level \u001B[38;5;241m+\u001B[39m\u001B[38;5;241m=\u001B[39m \u001B[38;5;241m1\u001B[39m\n\u001B[0;32m--> 126\u001B[0m \u001B[38;5;28;01mreturn\u001B[39;00m \u001B[43m_bootstrap\u001B[49m\u001B[38;5;241;43m.\u001B[39;49m\u001B[43m_gcd_import\u001B[49m\u001B[43m(\u001B[49m\u001B[43mname\u001B[49m\u001B[43m[\u001B[49m\u001B[43mlevel\u001B[49m\u001B[43m:\u001B[49m\u001B[43m]\u001B[49m\u001B[43m,\u001B[49m\u001B[43m \u001B[49m\u001B[43mpackage\u001B[49m\u001B[43m,\u001B[49m\u001B[43m \u001B[49m\u001B[43mlevel\u001B[49m\u001B[43m)\u001B[49m\n",
      "File \u001B[0;32m<frozen importlib._bootstrap>:1050\u001B[0m, in \u001B[0;36m_gcd_import\u001B[0;34m(name, package, level)\u001B[0m\n",
      "File \u001B[0;32m<frozen importlib._bootstrap>:1027\u001B[0m, in \u001B[0;36m_find_and_load\u001B[0;34m(name, import_)\u001B[0m\n",
      "File \u001B[0;32m<frozen importlib._bootstrap>:1006\u001B[0m, in \u001B[0;36m_find_and_load_unlocked\u001B[0;34m(name, import_)\u001B[0m\n",
      "File \u001B[0;32m<frozen importlib._bootstrap>:688\u001B[0m, in \u001B[0;36m_load_unlocked\u001B[0;34m(spec)\u001B[0m\n",
      "File \u001B[0;32m<frozen importlib._bootstrap_external>:883\u001B[0m, in \u001B[0;36mexec_module\u001B[0;34m(self, module)\u001B[0m\n",
      "File \u001B[0;32m<frozen importlib._bootstrap>:241\u001B[0m, in \u001B[0;36m_call_with_frames_removed\u001B[0;34m(f, *args, **kwds)\u001B[0m\n",
      "File \u001B[0;32m/opt/anaconda3/envs/langchain/lib/python3.10/site-packages/transformers/generation/utils.py:30\u001B[0m\n\u001B[1;32m     28\u001B[0m \u001B[38;5;28;01mfrom\u001B[39;00m \u001B[38;5;21;01mtorch\u001B[39;00m\u001B[38;5;21;01m.\u001B[39;00m\u001B[38;5;21;01mnn\u001B[39;00m \u001B[38;5;28;01mimport\u001B[39;00m functional \u001B[38;5;28;01mas\u001B[39;00m F\n\u001B[0;32m---> 30\u001B[0m \u001B[38;5;28;01mfrom\u001B[39;00m \u001B[38;5;21;01mtransformers\u001B[39;00m\u001B[38;5;21;01m.\u001B[39;00m\u001B[38;5;21;01mgeneration\u001B[39;00m\u001B[38;5;21;01m.\u001B[39;00m\u001B[38;5;21;01mcandidate_generator\u001B[39;00m \u001B[38;5;28;01mimport\u001B[39;00m AssistantVocabTranslatorCache\n\u001B[1;32m     32\u001B[0m \u001B[38;5;28;01mfrom\u001B[39;00m \u001B[38;5;21;01m.\u001B[39;00m\u001B[38;5;21;01m.\u001B[39;00m\u001B[38;5;21;01mcache_utils\u001B[39;00m \u001B[38;5;28;01mimport\u001B[39;00m (\n\u001B[1;32m     33\u001B[0m     Cache,\n\u001B[1;32m     34\u001B[0m     DynamicCache,\n\u001B[0;32m   (...)\u001B[0m\n\u001B[1;32m     38\u001B[0m     StaticCache,\n\u001B[1;32m     39\u001B[0m )\n",
      "File \u001B[0;32m/opt/anaconda3/envs/langchain/lib/python3.10/site-packages/transformers/generation/candidate_generator.py:27\u001B[0m\n\u001B[1;32m     26\u001B[0m \u001B[38;5;28;01mif\u001B[39;00m is_sklearn_available():\n\u001B[0;32m---> 27\u001B[0m     \u001B[38;5;28;01mfrom\u001B[39;00m \u001B[38;5;21;01msklearn\u001B[39;00m\u001B[38;5;21;01m.\u001B[39;00m\u001B[38;5;21;01mmetrics\u001B[39;00m \u001B[38;5;28;01mimport\u001B[39;00m roc_curve\n\u001B[1;32m     29\u001B[0m \u001B[38;5;28;01mfrom\u001B[39;00m \u001B[38;5;21;01m.\u001B[39;00m\u001B[38;5;21;01m.\u001B[39;00m\u001B[38;5;21;01mcache_utils\u001B[39;00m \u001B[38;5;28;01mimport\u001B[39;00m DynamicCache\n",
      "File \u001B[0;32m/opt/anaconda3/envs/langchain/lib/python3.10/site-packages/sklearn/__init__.py:73\u001B[0m\n\u001B[1;32m     69\u001B[0m \u001B[38;5;28;01mfrom\u001B[39;00m \u001B[38;5;21;01m.\u001B[39;00m \u001B[38;5;28;01mimport\u001B[39;00m (  \u001B[38;5;66;03m# noqa: F401 E402\u001B[39;00m\n\u001B[1;32m     70\u001B[0m     __check_build,\n\u001B[1;32m     71\u001B[0m     _distributor_init,\n\u001B[1;32m     72\u001B[0m )\n\u001B[0;32m---> 73\u001B[0m \u001B[38;5;28;01mfrom\u001B[39;00m \u001B[38;5;21;01m.\u001B[39;00m\u001B[38;5;21;01mbase\u001B[39;00m \u001B[38;5;28;01mimport\u001B[39;00m clone  \u001B[38;5;66;03m# noqa: E402\u001B[39;00m\n\u001B[1;32m     74\u001B[0m \u001B[38;5;28;01mfrom\u001B[39;00m \u001B[38;5;21;01m.\u001B[39;00m\u001B[38;5;21;01mutils\u001B[39;00m\u001B[38;5;21;01m.\u001B[39;00m\u001B[38;5;21;01m_show_versions\u001B[39;00m \u001B[38;5;28;01mimport\u001B[39;00m show_versions  \u001B[38;5;66;03m# noqa: E402\u001B[39;00m\n",
      "File \u001B[0;32m/opt/anaconda3/envs/langchain/lib/python3.10/site-packages/sklearn/base.py:19\u001B[0m\n\u001B[1;32m     18\u001B[0m \u001B[38;5;28;01mfrom\u001B[39;00m \u001B[38;5;21;01m.\u001B[39;00m\u001B[38;5;21;01mexceptions\u001B[39;00m \u001B[38;5;28;01mimport\u001B[39;00m InconsistentVersionWarning\n\u001B[0;32m---> 19\u001B[0m \u001B[38;5;28;01mfrom\u001B[39;00m \u001B[38;5;21;01m.\u001B[39;00m\u001B[38;5;21;01mutils\u001B[39;00m\u001B[38;5;21;01m.\u001B[39;00m\u001B[38;5;21;01m_estimator_html_repr\u001B[39;00m \u001B[38;5;28;01mimport\u001B[39;00m _HTMLDocumentationLinkMixin, estimator_html_repr\n\u001B[1;32m     20\u001B[0m \u001B[38;5;28;01mfrom\u001B[39;00m \u001B[38;5;21;01m.\u001B[39;00m\u001B[38;5;21;01mutils\u001B[39;00m\u001B[38;5;21;01m.\u001B[39;00m\u001B[38;5;21;01m_metadata_requests\u001B[39;00m \u001B[38;5;28;01mimport\u001B[39;00m _MetadataRequester, _routing_enabled\n",
      "File \u001B[0;32m/opt/anaconda3/envs/langchain/lib/python3.10/site-packages/sklearn/utils/__init__.py:15\u001B[0m\n\u001B[1;32m     14\u001B[0m \u001B[38;5;28;01mfrom\u001B[39;00m \u001B[38;5;21;01m.\u001B[39;00m\u001B[38;5;21;01m_bunch\u001B[39;00m \u001B[38;5;28;01mimport\u001B[39;00m Bunch\n\u001B[0;32m---> 15\u001B[0m \u001B[38;5;28;01mfrom\u001B[39;00m \u001B[38;5;21;01m.\u001B[39;00m\u001B[38;5;21;01m_chunking\u001B[39;00m \u001B[38;5;28;01mimport\u001B[39;00m gen_batches, gen_even_slices\n\u001B[1;32m     16\u001B[0m \u001B[38;5;28;01mfrom\u001B[39;00m \u001B[38;5;21;01m.\u001B[39;00m\u001B[38;5;21;01m_estimator_html_repr\u001B[39;00m \u001B[38;5;28;01mimport\u001B[39;00m estimator_html_repr\n",
      "File \u001B[0;32m/opt/anaconda3/envs/langchain/lib/python3.10/site-packages/sklearn/utils/_chunking.py:11\u001B[0m\n\u001B[1;32m     10\u001B[0m \u001B[38;5;28;01mfrom\u001B[39;00m \u001B[38;5;21;01m.\u001B[39;00m\u001B[38;5;21;01m.\u001B[39;00m\u001B[38;5;21;01m_config\u001B[39;00m \u001B[38;5;28;01mimport\u001B[39;00m get_config\n\u001B[0;32m---> 11\u001B[0m \u001B[38;5;28;01mfrom\u001B[39;00m \u001B[38;5;21;01m.\u001B[39;00m\u001B[38;5;21;01m_param_validation\u001B[39;00m \u001B[38;5;28;01mimport\u001B[39;00m Interval, validate_params\n\u001B[1;32m     14\u001B[0m \u001B[38;5;28;01mdef\u001B[39;00m \u001B[38;5;21mchunk_generator\u001B[39m(gen, chunksize):\n",
      "File \u001B[0;32m/opt/anaconda3/envs/langchain/lib/python3.10/site-packages/sklearn/utils/_param_validation.py:17\u001B[0m\n\u001B[1;32m     16\u001B[0m \u001B[38;5;28;01mfrom\u001B[39;00m \u001B[38;5;21;01m.\u001B[39;00m\u001B[38;5;21;01m.\u001B[39;00m\u001B[38;5;21;01m_config\u001B[39;00m \u001B[38;5;28;01mimport\u001B[39;00m config_context, get_config\n\u001B[0;32m---> 17\u001B[0m \u001B[38;5;28;01mfrom\u001B[39;00m \u001B[38;5;21;01m.\u001B[39;00m\u001B[38;5;21;01mvalidation\u001B[39;00m \u001B[38;5;28;01mimport\u001B[39;00m _is_arraylike_not_scalar\n\u001B[1;32m     20\u001B[0m \u001B[38;5;28;01mclass\u001B[39;00m \u001B[38;5;21;01mInvalidParameterError\u001B[39;00m(\u001B[38;5;167;01mValueError\u001B[39;00m, \u001B[38;5;167;01mTypeError\u001B[39;00m):\n",
      "File \u001B[0;32m/opt/anaconda3/envs/langchain/lib/python3.10/site-packages/sklearn/utils/validation.py:21\u001B[0m\n\u001B[1;32m     20\u001B[0m \u001B[38;5;28;01mfrom\u001B[39;00m \u001B[38;5;21;01m.\u001B[39;00m\u001B[38;5;21;01m.\u001B[39;00m\u001B[38;5;21;01mexceptions\u001B[39;00m \u001B[38;5;28;01mimport\u001B[39;00m DataConversionWarning, NotFittedError, PositiveSpectrumWarning\n\u001B[0;32m---> 21\u001B[0m \u001B[38;5;28;01mfrom\u001B[39;00m \u001B[38;5;21;01m.\u001B[39;00m\u001B[38;5;21;01m.\u001B[39;00m\u001B[38;5;21;01mutils\u001B[39;00m\u001B[38;5;21;01m.\u001B[39;00m\u001B[38;5;21;01m_array_api\u001B[39;00m \u001B[38;5;28;01mimport\u001B[39;00m _asarray_with_order, _is_numpy_namespace, get_namespace\n\u001B[1;32m     22\u001B[0m \u001B[38;5;28;01mfrom\u001B[39;00m \u001B[38;5;21;01m.\u001B[39;00m\u001B[38;5;21;01m.\u001B[39;00m\u001B[38;5;21;01mutils\u001B[39;00m\u001B[38;5;21;01m.\u001B[39;00m\u001B[38;5;21;01mdeprecation\u001B[39;00m \u001B[38;5;28;01mimport\u001B[39;00m _deprecate_force_all_finite\n",
      "File \u001B[0;32m/opt/anaconda3/envs/langchain/lib/python3.10/site-packages/sklearn/utils/_array_api.py:14\u001B[0m\n\u001B[1;32m     13\u001B[0m \u001B[38;5;28;01mimport\u001B[39;00m \u001B[38;5;21;01mscipy\u001B[39;00m\u001B[38;5;21;01m.\u001B[39;00m\u001B[38;5;21;01msparse\u001B[39;00m \u001B[38;5;28;01mas\u001B[39;00m \u001B[38;5;21;01msp\u001B[39;00m\n\u001B[0;32m---> 14\u001B[0m \u001B[38;5;28;01mimport\u001B[39;00m \u001B[38;5;21;01mscipy\u001B[39;00m\u001B[38;5;21;01m.\u001B[39;00m\u001B[38;5;21;01mspecial\u001B[39;00m \u001B[38;5;28;01mas\u001B[39;00m \u001B[38;5;21;01mspecial\u001B[39;00m\n\u001B[1;32m     16\u001B[0m \u001B[38;5;28;01mfrom\u001B[39;00m \u001B[38;5;21;01m.\u001B[39;00m\u001B[38;5;21;01m.\u001B[39;00m\u001B[38;5;21;01m_config\u001B[39;00m \u001B[38;5;28;01mimport\u001B[39;00m get_config\n",
      "File \u001B[0;32m/opt/anaconda3/envs/langchain/lib/python3.10/site-packages/scipy/special/__init__.py:826\u001B[0m\n\u001B[1;32m    821\u001B[0m \u001B[38;5;28;01mfrom\u001B[39;00m \u001B[38;5;21;01m.\u001B[39;00m\u001B[38;5;21;01m_support_alternative_backends\u001B[39;00m \u001B[38;5;28;01mimport\u001B[39;00m (\n\u001B[1;32m    822\u001B[0m     log_ndtr, ndtr, ndtri, erf, erfc, i0, i0e, i1, i1e, gammaln,\n\u001B[1;32m    823\u001B[0m     gammainc, gammaincc, logit, expit, entr, rel_entr, xlogy,\n\u001B[1;32m    824\u001B[0m     chdtr, chdtrc, betainc, betaincc, stdtr)\n\u001B[0;32m--> 826\u001B[0m \u001B[38;5;28;01mfrom\u001B[39;00m \u001B[38;5;21;01m.\u001B[39;00m \u001B[38;5;28;01mimport\u001B[39;00m _basic\n\u001B[1;32m    827\u001B[0m \u001B[38;5;28;01mfrom\u001B[39;00m \u001B[38;5;21;01m.\u001B[39;00m\u001B[38;5;21;01m_basic\u001B[39;00m \u001B[38;5;28;01mimport\u001B[39;00m \u001B[38;5;241m*\u001B[39m\n",
      "File \u001B[0;32m/opt/anaconda3/envs/langchain/lib/python3.10/site-packages/scipy/special/_basic.py:22\u001B[0m\n\u001B[1;32m     21\u001B[0m \u001B[38;5;28;01mfrom\u001B[39;00m \u001B[38;5;21;01m.\u001B[39;00m\u001B[38;5;21;01m_comb\u001B[39;00m \u001B[38;5;28;01mimport\u001B[39;00m _comb_int\n\u001B[0;32m---> 22\u001B[0m \u001B[38;5;28;01mfrom\u001B[39;00m \u001B[38;5;21;01m.\u001B[39;00m\u001B[38;5;21;01m_multiufuncs\u001B[39;00m \u001B[38;5;28;01mimport\u001B[39;00m (assoc_legendre_p_all,\n\u001B[1;32m     23\u001B[0m                            legendre_p_all)\n\u001B[1;32m     24\u001B[0m \u001B[38;5;28;01mfrom\u001B[39;00m \u001B[38;5;21;01mscipy\u001B[39;00m\u001B[38;5;21;01m.\u001B[39;00m\u001B[38;5;21;01m_lib\u001B[39;00m\u001B[38;5;21;01m.\u001B[39;00m\u001B[38;5;21;01mdeprecation\u001B[39;00m \u001B[38;5;28;01mimport\u001B[39;00m _deprecated\n",
      "File \u001B[0;32m/opt/anaconda3/envs/langchain/lib/python3.10/site-packages/scipy/special/_multiufuncs.py:142\u001B[0m\n\u001B[1;32m    139\u001B[0m         \u001B[38;5;28;01mreturn\u001B[39;00m out\n\u001B[0;32m--> 142\u001B[0m sph_legendre_p \u001B[38;5;241m=\u001B[39m \u001B[43mMultiUFunc\u001B[49m\u001B[43m(\u001B[49m\n\u001B[1;32m    143\u001B[0m \u001B[43m    \u001B[49m\u001B[43msph_legendre_p\u001B[49m\u001B[43m,\u001B[49m\n\u001B[1;32m    144\u001B[0m \u001B[38;5;250;43m    \u001B[39;49m\u001B[38;5;124;43mr\u001B[39;49m\u001B[38;5;124;43;03m\"\"\"sph_legendre_p(n, m, theta, *, diff_n=0)\u001B[39;49;00m\n\u001B[1;32m    145\u001B[0m \n\u001B[1;32m    146\u001B[0m \u001B[38;5;124;43;03m    Spherical Legendre polynomial of the first kind.\u001B[39;49;00m\n\u001B[1;32m    147\u001B[0m \n\u001B[1;32m    148\u001B[0m \u001B[38;5;124;43;03m    Parameters\u001B[39;49;00m\n\u001B[1;32m    149\u001B[0m \u001B[38;5;124;43;03m    ----------\u001B[39;49;00m\n\u001B[1;32m    150\u001B[0m \u001B[38;5;124;43;03m    n : ArrayLike[int]\u001B[39;49;00m\n\u001B[1;32m    151\u001B[0m \u001B[38;5;124;43;03m        Degree of the spherical Legendre polynomial. Must have ``n >= 0``.\u001B[39;49;00m\n\u001B[1;32m    152\u001B[0m \u001B[38;5;124;43;03m    m : ArrayLike[int]\u001B[39;49;00m\n\u001B[1;32m    153\u001B[0m \u001B[38;5;124;43;03m        Order of the spherical Legendre polynomial.\u001B[39;49;00m\n\u001B[1;32m    154\u001B[0m \u001B[38;5;124;43;03m    theta : ArrayLike[float]\u001B[39;49;00m\n\u001B[1;32m    155\u001B[0m \u001B[38;5;124;43;03m        Input value.\u001B[39;49;00m\n\u001B[1;32m    156\u001B[0m \u001B[38;5;124;43;03m    diff_n : Optional[int]\u001B[39;49;00m\n\u001B[1;32m    157\u001B[0m \u001B[38;5;124;43;03m        A non-negative integer. Compute and return all derivatives up\u001B[39;49;00m\n\u001B[1;32m    158\u001B[0m \u001B[38;5;124;43;03m        to order ``diff_n``. Default is 0.\u001B[39;49;00m\n\u001B[1;32m    159\u001B[0m \n\u001B[1;32m    160\u001B[0m \u001B[38;5;124;43;03m    Returns\u001B[39;49;00m\n\u001B[1;32m    161\u001B[0m \u001B[38;5;124;43;03m    -------\u001B[39;49;00m\n\u001B[1;32m    162\u001B[0m \u001B[38;5;124;43;03m    p : ndarray or tuple[ndarray]\u001B[39;49;00m\n\u001B[1;32m    163\u001B[0m \u001B[38;5;124;43;03m        Spherical Legendre polynomial with ``diff_n`` derivatives.\u001B[39;49;00m\n\u001B[1;32m    164\u001B[0m \n\u001B[1;32m    165\u001B[0m \u001B[38;5;124;43;03m    Notes\u001B[39;49;00m\n\u001B[1;32m    166\u001B[0m \u001B[38;5;124;43;03m    -----\u001B[39;49;00m\n\u001B[1;32m    167\u001B[0m \u001B[38;5;124;43;03m    The spherical counterpart of an (unnormalized) associated Legendre polynomial has\u001B[39;49;00m\n\u001B[1;32m    168\u001B[0m \u001B[38;5;124;43;03m    the additional factor\u001B[39;49;00m\n\u001B[1;32m    169\u001B[0m \n\u001B[1;32m    170\u001B[0m \u001B[38;5;124;43;03m    .. math::\u001B[39;49;00m\n\u001B[1;32m    171\u001B[0m \n\u001B[1;32m    172\u001B[0m \u001B[38;5;124;43;03m        \\sqrt{\\frac{(2 n + 1) (n - m)!}{4 \\pi (n + m)!}}\u001B[39;49;00m\n\u001B[1;32m    173\u001B[0m \n\u001B[1;32m    174\u001B[0m \u001B[38;5;124;43;03m    It is the same as the spherical harmonic :math:`Y_{n}^{m}(\\theta, \\phi)`\u001B[39;49;00m\n\u001B[1;32m    175\u001B[0m \u001B[38;5;124;43;03m    with :math:`\\phi = 0`.\u001B[39;49;00m\n\u001B[1;32m    176\u001B[0m \u001B[38;5;124;43;03m    \"\"\"\u001B[39;49;00m\u001B[43m,\u001B[49m\u001B[43m \u001B[49m\u001B[43mdiff_n\u001B[49m\u001B[38;5;241;43m=\u001B[39;49m\u001B[38;5;241;43m0\u001B[39;49m\n\u001B[1;32m    177\u001B[0m \u001B[43m)\u001B[49m\n\u001B[1;32m    180\u001B[0m \u001B[38;5;129m@sph_legendre_p\u001B[39m\u001B[38;5;241m.\u001B[39m_override_key\n\u001B[1;32m    181\u001B[0m \u001B[38;5;28;01mdef\u001B[39;00m \u001B[38;5;21m_\u001B[39m(diff_n):\n",
      "File \u001B[0;32m/opt/anaconda3/envs/langchain/lib/python3.10/site-packages/scipy/special/_multiufuncs.py:41\u001B[0m, in \u001B[0;36mMultiUFunc.__init__\u001B[0;34m(self, ufunc_or_ufuncs, doc, force_complex_output, **default_kwargs)\u001B[0m\n\u001B[1;32m     40\u001B[0m \u001B[38;5;28;01mif\u001B[39;00m \u001B[38;5;129;01mnot\u001B[39;00m \u001B[38;5;28misinstance\u001B[39m(ufunc, np\u001B[38;5;241m.\u001B[39mufunc):\n\u001B[0;32m---> 41\u001B[0m     \u001B[38;5;28;01mraise\u001B[39;00m \u001B[38;5;167;01mValueError\u001B[39;00m(\u001B[38;5;124m\"\u001B[39m\u001B[38;5;124mAll ufuncs must have type `numpy.ufunc`.\u001B[39m\u001B[38;5;124m\"\u001B[39m\n\u001B[1;32m     42\u001B[0m                      \u001B[38;5;124mf\u001B[39m\u001B[38;5;124m\"\u001B[39m\u001B[38;5;124m Received \u001B[39m\u001B[38;5;132;01m{\u001B[39;00mufunc_or_ufuncs\u001B[38;5;132;01m}\u001B[39;00m\u001B[38;5;124m\"\u001B[39m)\n\u001B[1;32m     43\u001B[0m seen_input_types\u001B[38;5;241m.\u001B[39madd(\u001B[38;5;28mfrozenset\u001B[39m(x\u001B[38;5;241m.\u001B[39msplit(\u001B[38;5;124m\"\u001B[39m\u001B[38;5;124m->\u001B[39m\u001B[38;5;124m\"\u001B[39m)[\u001B[38;5;241m0\u001B[39m] \u001B[38;5;28;01mfor\u001B[39;00m x \u001B[38;5;129;01min\u001B[39;00m ufunc\u001B[38;5;241m.\u001B[39mtypes))\n",
      "\u001B[0;31mValueError\u001B[0m: All ufuncs must have type `numpy.ufunc`. Received (<ufunc 'sph_legendre_p'>, <ufunc 'sph_legendre_p'>, <ufunc 'sph_legendre_p'>)",
      "\nThe above exception was the direct cause of the following exception:\n",
      "\u001B[0;31mRuntimeError\u001B[0m                              Traceback (most recent call last)",
      "File \u001B[0;32m/opt/anaconda3/envs/langchain/lib/python3.10/site-packages/transformers/utils/import_utils.py:1967\u001B[0m, in \u001B[0;36m_LazyModule._get_module\u001B[0;34m(self, module_name)\u001B[0m\n\u001B[1;32m   1966\u001B[0m \u001B[38;5;28;01mtry\u001B[39;00m:\n\u001B[0;32m-> 1967\u001B[0m     \u001B[38;5;28;01mreturn\u001B[39;00m \u001B[43mimportlib\u001B[49m\u001B[38;5;241;43m.\u001B[39;49m\u001B[43mimport_module\u001B[49m\u001B[43m(\u001B[49m\u001B[38;5;124;43m\"\u001B[39;49m\u001B[38;5;124;43m.\u001B[39;49m\u001B[38;5;124;43m\"\u001B[39;49m\u001B[43m \u001B[49m\u001B[38;5;241;43m+\u001B[39;49m\u001B[43m \u001B[49m\u001B[43mmodule_name\u001B[49m\u001B[43m,\u001B[49m\u001B[43m \u001B[49m\u001B[38;5;28;43mself\u001B[39;49m\u001B[38;5;241;43m.\u001B[39;49m\u001B[38;5;18;43m__name__\u001B[39;49m\u001B[43m)\u001B[49m\n\u001B[1;32m   1968\u001B[0m \u001B[38;5;28;01mexcept\u001B[39;00m \u001B[38;5;167;01mException\u001B[39;00m \u001B[38;5;28;01mas\u001B[39;00m e:\n",
      "File \u001B[0;32m/opt/anaconda3/envs/langchain/lib/python3.10/importlib/__init__.py:126\u001B[0m, in \u001B[0;36mimport_module\u001B[0;34m(name, package)\u001B[0m\n\u001B[1;32m    125\u001B[0m         level \u001B[38;5;241m+\u001B[39m\u001B[38;5;241m=\u001B[39m \u001B[38;5;241m1\u001B[39m\n\u001B[0;32m--> 126\u001B[0m \u001B[38;5;28;01mreturn\u001B[39;00m \u001B[43m_bootstrap\u001B[49m\u001B[38;5;241;43m.\u001B[39;49m\u001B[43m_gcd_import\u001B[49m\u001B[43m(\u001B[49m\u001B[43mname\u001B[49m\u001B[43m[\u001B[49m\u001B[43mlevel\u001B[49m\u001B[43m:\u001B[49m\u001B[43m]\u001B[49m\u001B[43m,\u001B[49m\u001B[43m \u001B[49m\u001B[43mpackage\u001B[49m\u001B[43m,\u001B[49m\u001B[43m \u001B[49m\u001B[43mlevel\u001B[49m\u001B[43m)\u001B[49m\n",
      "File \u001B[0;32m<frozen importlib._bootstrap>:1050\u001B[0m, in \u001B[0;36m_gcd_import\u001B[0;34m(name, package, level)\u001B[0m\n",
      "File \u001B[0;32m<frozen importlib._bootstrap>:1027\u001B[0m, in \u001B[0;36m_find_and_load\u001B[0;34m(name, import_)\u001B[0m\n",
      "File \u001B[0;32m<frozen importlib._bootstrap>:1006\u001B[0m, in \u001B[0;36m_find_and_load_unlocked\u001B[0;34m(name, import_)\u001B[0m\n",
      "File \u001B[0;32m<frozen importlib._bootstrap>:688\u001B[0m, in \u001B[0;36m_load_unlocked\u001B[0;34m(spec)\u001B[0m\n",
      "File \u001B[0;32m<frozen importlib._bootstrap_external>:883\u001B[0m, in \u001B[0;36mexec_module\u001B[0;34m(self, module)\u001B[0m\n",
      "File \u001B[0;32m<frozen importlib._bootstrap>:241\u001B[0m, in \u001B[0;36m_call_with_frames_removed\u001B[0;34m(f, *args, **kwds)\u001B[0m\n",
      "File \u001B[0;32m/opt/anaconda3/envs/langchain/lib/python3.10/site-packages/transformers/models/bert/modeling_bert.py:31\u001B[0m\n\u001B[1;32m     30\u001B[0m \u001B[38;5;28;01mfrom\u001B[39;00m \u001B[38;5;21;01m.\u001B[39;00m\u001B[38;5;21;01m.\u001B[39;00m\u001B[38;5;21;01m.\u001B[39;00m\u001B[38;5;21;01mactivations\u001B[39;00m \u001B[38;5;28;01mimport\u001B[39;00m ACT2FN\n\u001B[0;32m---> 31\u001B[0m \u001B[38;5;28;01mfrom\u001B[39;00m \u001B[38;5;21;01m.\u001B[39;00m\u001B[38;5;21;01m.\u001B[39;00m\u001B[38;5;21;01m.\u001B[39;00m\u001B[38;5;21;01mgeneration\u001B[39;00m \u001B[38;5;28;01mimport\u001B[39;00m GenerationMixin\n\u001B[1;32m     32\u001B[0m \u001B[38;5;28;01mfrom\u001B[39;00m \u001B[38;5;21;01m.\u001B[39;00m\u001B[38;5;21;01m.\u001B[39;00m\u001B[38;5;21;01m.\u001B[39;00m\u001B[38;5;21;01mmodeling_attn_mask_utils\u001B[39;00m \u001B[38;5;28;01mimport\u001B[39;00m (\n\u001B[1;32m     33\u001B[0m     _prepare_4d_attention_mask_for_sdpa,\n\u001B[1;32m     34\u001B[0m     _prepare_4d_causal_attention_mask_for_sdpa,\n\u001B[1;32m     35\u001B[0m )\n",
      "File \u001B[0;32m<frozen importlib._bootstrap>:1075\u001B[0m, in \u001B[0;36m_handle_fromlist\u001B[0;34m(module, fromlist, import_, recursive)\u001B[0m\n",
      "File \u001B[0;32m/opt/anaconda3/envs/langchain/lib/python3.10/site-packages/transformers/utils/import_utils.py:1955\u001B[0m, in \u001B[0;36m_LazyModule.__getattr__\u001B[0;34m(self, name)\u001B[0m\n\u001B[1;32m   1954\u001B[0m \u001B[38;5;28;01melif\u001B[39;00m name \u001B[38;5;129;01min\u001B[39;00m \u001B[38;5;28mself\u001B[39m\u001B[38;5;241m.\u001B[39m_class_to_module\u001B[38;5;241m.\u001B[39mkeys():\n\u001B[0;32m-> 1955\u001B[0m     module \u001B[38;5;241m=\u001B[39m \u001B[38;5;28;43mself\u001B[39;49m\u001B[38;5;241;43m.\u001B[39;49m\u001B[43m_get_module\u001B[49m\u001B[43m(\u001B[49m\u001B[38;5;28;43mself\u001B[39;49m\u001B[38;5;241;43m.\u001B[39;49m\u001B[43m_class_to_module\u001B[49m\u001B[43m[\u001B[49m\u001B[43mname\u001B[49m\u001B[43m]\u001B[49m\u001B[43m)\u001B[49m\n\u001B[1;32m   1956\u001B[0m     value \u001B[38;5;241m=\u001B[39m \u001B[38;5;28mgetattr\u001B[39m(module, name)\n",
      "File \u001B[0;32m/opt/anaconda3/envs/langchain/lib/python3.10/site-packages/transformers/utils/import_utils.py:1969\u001B[0m, in \u001B[0;36m_LazyModule._get_module\u001B[0;34m(self, module_name)\u001B[0m\n\u001B[1;32m   1968\u001B[0m \u001B[38;5;28;01mexcept\u001B[39;00m \u001B[38;5;167;01mException\u001B[39;00m \u001B[38;5;28;01mas\u001B[39;00m e:\n\u001B[0;32m-> 1969\u001B[0m     \u001B[38;5;28;01mraise\u001B[39;00m \u001B[38;5;167;01mRuntimeError\u001B[39;00m(\n\u001B[1;32m   1970\u001B[0m         \u001B[38;5;124mf\u001B[39m\u001B[38;5;124m\"\u001B[39m\u001B[38;5;124mFailed to import \u001B[39m\u001B[38;5;132;01m{\u001B[39;00m\u001B[38;5;28mself\u001B[39m\u001B[38;5;241m.\u001B[39m\u001B[38;5;18m__name__\u001B[39m\u001B[38;5;132;01m}\u001B[39;00m\u001B[38;5;124m.\u001B[39m\u001B[38;5;132;01m{\u001B[39;00mmodule_name\u001B[38;5;132;01m}\u001B[39;00m\u001B[38;5;124m because of the following error (look up to see its\u001B[39m\u001B[38;5;124m\"\u001B[39m\n\u001B[1;32m   1971\u001B[0m         \u001B[38;5;124mf\u001B[39m\u001B[38;5;124m\"\u001B[39m\u001B[38;5;124m traceback):\u001B[39m\u001B[38;5;130;01m\\n\u001B[39;00m\u001B[38;5;132;01m{\u001B[39;00me\u001B[38;5;132;01m}\u001B[39;00m\u001B[38;5;124m\"\u001B[39m\n\u001B[1;32m   1972\u001B[0m     ) \u001B[38;5;28;01mfrom\u001B[39;00m \u001B[38;5;21;01me\u001B[39;00m\n",
      "\u001B[0;31mRuntimeError\u001B[0m: Failed to import transformers.generation.utils because of the following error (look up to see its traceback):\nAll ufuncs must have type `numpy.ufunc`. Received (<ufunc 'sph_legendre_p'>, <ufunc 'sph_legendre_p'>, <ufunc 'sph_legendre_p'>)",
      "\nThe above exception was the direct cause of the following exception:\n",
      "\u001B[0;31mRuntimeError\u001B[0m                              Traceback (most recent call last)",
      "Cell \u001B[0;32mIn[8], line 1\u001B[0m\n\u001B[0;32m----> 1\u001B[0m \u001B[38;5;28;01mfrom\u001B[39;00m \u001B[38;5;21;01mtext2vec\u001B[39;00m \u001B[38;5;28;01mimport\u001B[39;00m SentenceModel\n\u001B[1;32m      3\u001B[0m texts \u001B[38;5;241m=\u001B[39m [\n\u001B[1;32m      4\u001B[0m     \u001B[38;5;124m\"\u001B[39m\u001B[38;5;124m娃哈哈\u001B[39m\u001B[38;5;124m\"\u001B[39m,\n\u001B[1;32m      5\u001B[0m     \u001B[38;5;124m\"\u001B[39m\u001B[38;5;124m你好\u001B[39m\u001B[38;5;124m\"\u001B[39m,\n\u001B[1;32m      6\u001B[0m     \u001B[38;5;124m\"\u001B[39m\u001B[38;5;124m你是谁？\u001B[39m\u001B[38;5;124m\"\u001B[39m,\n\u001B[1;32m      7\u001B[0m     \u001B[38;5;124m\"\u001B[39m\u001B[38;5;124m介绍一下自己\u001B[39m\u001B[38;5;124m\"\u001B[39m\n\u001B[1;32m      8\u001B[0m ]\n\u001B[1;32m     10\u001B[0m model \u001B[38;5;241m=\u001B[39m SentenceModel(\u001B[38;5;124m\"\u001B[39m\u001B[38;5;124m/Users/shilihua/.cache/modelscope/hub/models/maidalun/bce-embedding-base_v1\u001B[39m\u001B[38;5;124m\"\u001B[39m)\n",
      "File \u001B[0;32m/opt/anaconda3/envs/langchain/lib/python3.10/site-packages/text2vec/__init__.py:8\u001B[0m\n\u001B[1;32m      2\u001B[0m \u001B[38;5;124;03m\"\"\"\u001B[39;00m\n\u001B[1;32m      3\u001B[0m \u001B[38;5;124;03m@author:XuMing(xuming624@qq.com)\u001B[39;00m\n\u001B[1;32m      4\u001B[0m \u001B[38;5;124;03m@description: \u001B[39;00m\n\u001B[1;32m      5\u001B[0m \u001B[38;5;124;03m\"\"\"\u001B[39;00m\n\u001B[1;32m      6\u001B[0m \u001B[38;5;28;01mfrom\u001B[39;00m \u001B[38;5;21;01mtext2vec\u001B[39;00m\u001B[38;5;21;01m.\u001B[39;00m\u001B[38;5;21;01mversion\u001B[39;00m \u001B[38;5;28;01mimport\u001B[39;00m __version__\n\u001B[0;32m----> 8\u001B[0m \u001B[38;5;28;01mfrom\u001B[39;00m \u001B[38;5;21;01mtext2vec\u001B[39;00m\u001B[38;5;21;01m.\u001B[39;00m\u001B[38;5;21;01mbertmatching_model\u001B[39;00m \u001B[38;5;28;01mimport\u001B[39;00m BertMatchModel\n\u001B[1;32m      9\u001B[0m \u001B[38;5;28;01mfrom\u001B[39;00m \u001B[38;5;21;01mtext2vec\u001B[39;00m\u001B[38;5;21;01m.\u001B[39;00m\u001B[38;5;21;01mbm25\u001B[39;00m \u001B[38;5;28;01mimport\u001B[39;00m BM25\n\u001B[1;32m     10\u001B[0m \u001B[38;5;28;01mfrom\u001B[39;00m \u001B[38;5;21;01mtext2vec\u001B[39;00m\u001B[38;5;21;01m.\u001B[39;00m\u001B[38;5;21;01mcosent_dataset\u001B[39;00m \u001B[38;5;28;01mimport\u001B[39;00m CosentTrainDataset, HFCosentTrainDataset, load_cosent_train_data\n",
      "File \u001B[0;32m/opt/anaconda3/envs/langchain/lib/python3.10/site-packages/text2vec/bertmatching_model.py:16\u001B[0m\n\u001B[1;32m     14\u001B[0m \u001B[38;5;28;01mfrom\u001B[39;00m \u001B[38;5;21;01mtorch\u001B[39;00m\u001B[38;5;21;01m.\u001B[39;00m\u001B[38;5;21;01mutils\u001B[39;00m\u001B[38;5;21;01m.\u001B[39;00m\u001B[38;5;21;01mdata\u001B[39;00m \u001B[38;5;28;01mimport\u001B[39;00m DataLoader, Dataset, DistributedSampler\n\u001B[1;32m     15\u001B[0m \u001B[38;5;28;01mfrom\u001B[39;00m \u001B[38;5;21;01mtqdm\u001B[39;00m \u001B[38;5;28;01mimport\u001B[39;00m tqdm, trange\n\u001B[0;32m---> 16\u001B[0m \u001B[38;5;28;01mfrom\u001B[39;00m \u001B[38;5;21;01mtransformers\u001B[39;00m \u001B[38;5;28;01mimport\u001B[39;00m BertForSequenceClassification, BertTokenizer\n\u001B[1;32m     17\u001B[0m \u001B[38;5;28;01mfrom\u001B[39;00m \u001B[38;5;21;01mtransformers\u001B[39;00m\u001B[38;5;21;01m.\u001B[39;00m\u001B[38;5;21;01moptimization\u001B[39;00m \u001B[38;5;28;01mimport\u001B[39;00m AdamW, get_linear_schedule_with_warmup\n\u001B[1;32m     19\u001B[0m \u001B[38;5;28;01mfrom\u001B[39;00m \u001B[38;5;21;01mtext2vec\u001B[39;00m\u001B[38;5;21;01m.\u001B[39;00m\u001B[38;5;21;01mbertmatching_dataset\u001B[39;00m \u001B[38;5;28;01mimport\u001B[39;00m (\n\u001B[1;32m     20\u001B[0m     BertMatchingTestDataset,\n\u001B[1;32m     21\u001B[0m     BertMatchingTrainDataset,\n\u001B[1;32m     22\u001B[0m     HFBertMatchingTrainDataset,\n\u001B[1;32m     23\u001B[0m     HFBertMatchingTestDataset\n\u001B[1;32m     24\u001B[0m )\n",
      "File \u001B[0;32m<frozen importlib._bootstrap>:1075\u001B[0m, in \u001B[0;36m_handle_fromlist\u001B[0;34m(module, fromlist, import_, recursive)\u001B[0m\n",
      "File \u001B[0;32m/opt/anaconda3/envs/langchain/lib/python3.10/site-packages/transformers/utils/import_utils.py:1956\u001B[0m, in \u001B[0;36m_LazyModule.__getattr__\u001B[0;34m(self, name)\u001B[0m\n\u001B[1;32m   1954\u001B[0m \u001B[38;5;28;01melif\u001B[39;00m name \u001B[38;5;129;01min\u001B[39;00m \u001B[38;5;28mself\u001B[39m\u001B[38;5;241m.\u001B[39m_class_to_module\u001B[38;5;241m.\u001B[39mkeys():\n\u001B[1;32m   1955\u001B[0m     module \u001B[38;5;241m=\u001B[39m \u001B[38;5;28mself\u001B[39m\u001B[38;5;241m.\u001B[39m_get_module(\u001B[38;5;28mself\u001B[39m\u001B[38;5;241m.\u001B[39m_class_to_module[name])\n\u001B[0;32m-> 1956\u001B[0m     value \u001B[38;5;241m=\u001B[39m \u001B[38;5;28;43mgetattr\u001B[39;49m\u001B[43m(\u001B[49m\u001B[43mmodule\u001B[49m\u001B[43m,\u001B[49m\u001B[43m \u001B[49m\u001B[43mname\u001B[49m\u001B[43m)\u001B[49m\n\u001B[1;32m   1957\u001B[0m \u001B[38;5;28;01melif\u001B[39;00m name \u001B[38;5;129;01min\u001B[39;00m \u001B[38;5;28mself\u001B[39m\u001B[38;5;241m.\u001B[39m_modules:\n\u001B[1;32m   1958\u001B[0m     value \u001B[38;5;241m=\u001B[39m \u001B[38;5;28mself\u001B[39m\u001B[38;5;241m.\u001B[39m_get_module(name)\n",
      "File \u001B[0;32m/opt/anaconda3/envs/langchain/lib/python3.10/site-packages/transformers/utils/import_utils.py:1955\u001B[0m, in \u001B[0;36m_LazyModule.__getattr__\u001B[0;34m(self, name)\u001B[0m\n\u001B[1;32m   1953\u001B[0m     value \u001B[38;5;241m=\u001B[39m Placeholder\n\u001B[1;32m   1954\u001B[0m \u001B[38;5;28;01melif\u001B[39;00m name \u001B[38;5;129;01min\u001B[39;00m \u001B[38;5;28mself\u001B[39m\u001B[38;5;241m.\u001B[39m_class_to_module\u001B[38;5;241m.\u001B[39mkeys():\n\u001B[0;32m-> 1955\u001B[0m     module \u001B[38;5;241m=\u001B[39m \u001B[38;5;28;43mself\u001B[39;49m\u001B[38;5;241;43m.\u001B[39;49m\u001B[43m_get_module\u001B[49m\u001B[43m(\u001B[49m\u001B[38;5;28;43mself\u001B[39;49m\u001B[38;5;241;43m.\u001B[39;49m\u001B[43m_class_to_module\u001B[49m\u001B[43m[\u001B[49m\u001B[43mname\u001B[49m\u001B[43m]\u001B[49m\u001B[43m)\u001B[49m\n\u001B[1;32m   1956\u001B[0m     value \u001B[38;5;241m=\u001B[39m \u001B[38;5;28mgetattr\u001B[39m(module, name)\n\u001B[1;32m   1957\u001B[0m \u001B[38;5;28;01melif\u001B[39;00m name \u001B[38;5;129;01min\u001B[39;00m \u001B[38;5;28mself\u001B[39m\u001B[38;5;241m.\u001B[39m_modules:\n",
      "File \u001B[0;32m/opt/anaconda3/envs/langchain/lib/python3.10/site-packages/transformers/utils/import_utils.py:1969\u001B[0m, in \u001B[0;36m_LazyModule._get_module\u001B[0;34m(self, module_name)\u001B[0m\n\u001B[1;32m   1967\u001B[0m     \u001B[38;5;28;01mreturn\u001B[39;00m importlib\u001B[38;5;241m.\u001B[39mimport_module(\u001B[38;5;124m\"\u001B[39m\u001B[38;5;124m.\u001B[39m\u001B[38;5;124m\"\u001B[39m \u001B[38;5;241m+\u001B[39m module_name, \u001B[38;5;28mself\u001B[39m\u001B[38;5;241m.\u001B[39m\u001B[38;5;18m__name__\u001B[39m)\n\u001B[1;32m   1968\u001B[0m \u001B[38;5;28;01mexcept\u001B[39;00m \u001B[38;5;167;01mException\u001B[39;00m \u001B[38;5;28;01mas\u001B[39;00m e:\n\u001B[0;32m-> 1969\u001B[0m     \u001B[38;5;28;01mraise\u001B[39;00m \u001B[38;5;167;01mRuntimeError\u001B[39;00m(\n\u001B[1;32m   1970\u001B[0m         \u001B[38;5;124mf\u001B[39m\u001B[38;5;124m\"\u001B[39m\u001B[38;5;124mFailed to import \u001B[39m\u001B[38;5;132;01m{\u001B[39;00m\u001B[38;5;28mself\u001B[39m\u001B[38;5;241m.\u001B[39m\u001B[38;5;18m__name__\u001B[39m\u001B[38;5;132;01m}\u001B[39;00m\u001B[38;5;124m.\u001B[39m\u001B[38;5;132;01m{\u001B[39;00mmodule_name\u001B[38;5;132;01m}\u001B[39;00m\u001B[38;5;124m because of the following error (look up to see its\u001B[39m\u001B[38;5;124m\"\u001B[39m\n\u001B[1;32m   1971\u001B[0m         \u001B[38;5;124mf\u001B[39m\u001B[38;5;124m\"\u001B[39m\u001B[38;5;124m traceback):\u001B[39m\u001B[38;5;130;01m\\n\u001B[39;00m\u001B[38;5;132;01m{\u001B[39;00me\u001B[38;5;132;01m}\u001B[39;00m\u001B[38;5;124m\"\u001B[39m\n\u001B[1;32m   1972\u001B[0m     ) \u001B[38;5;28;01mfrom\u001B[39;00m \u001B[38;5;21;01me\u001B[39;00m\n",
      "\u001B[0;31mRuntimeError\u001B[0m: Failed to import transformers.models.bert.modeling_bert because of the following error (look up to see its traceback):\nFailed to import transformers.generation.utils because of the following error (look up to see its traceback):\nAll ufuncs must have type `numpy.ufunc`. Received (<ufunc 'sph_legendre_p'>, <ufunc 'sph_legendre_p'>, <ufunc 'sph_legendre_p'>)"
     ]
    }
   ],
   "source": [
    "from text2vec import SentenceModel\n",
    "\n",
    "texts = [\n",
    "    \"娃哈哈\",\n",
    "    \"你好\",\n",
    "    \"你是谁？\",\n",
    "    \"介绍一下自己\"\n",
    "]\n",
    "\n",
    "model = SentenceModel(\"/Users/shilihua/.cache/modelscope/hub/models/maidalun/bce-embedding-base_v1\")\n",
    "model.encode(texts)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "ca89f4572c9aea31",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "langchain",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.10.16"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
